<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="${ctx}/css/common.css" />
<link rel="stylesheet" href="${ctx}/jslib/layui/css/layui.css" media="all">
<jsp:include page="../inc.jsp"></jsp:include>
<meta http-equiv="X-UA-Compatible" content="edge" />
<title>提现审核</title>
<style>
	.rechargeContent{
		margin-left:120px;
	}
	td{
		border:none;
		height:20px;
	}
	.bid{
		width:150px;
	}
	input{
		width:150px;
	}
	.rechargeContent .toLeft{
		text-align:left;
	}
	#remark{
		width:252px;
		height:101px;
	}
	
	.pass{
		width:70px;
		height:30px;
		line-height:30px;
		background:#f9a61a;
		border:none;
		border-radius: 3px;
		color:white;
		margin-left:200px;
	}
	.list_wrap{
	    list-style: none;
	    margin-top: 5px;
	    padding-left: 10px;
	}
	.list_wrap li{
	    padding: 5px;
	}
</style>
<script type="text/javascript">
	$(function(){
		//加载上部详情信息
		$.ajax({
			type:"get",
			url:'${ctx}/tradeList/checkDetail/${id}?'+Math.random(),
			async:true,
			success:function(data){
				$("#payOrderNumber").html(CommonConverter.toEmptyString(data.obj.payOrderNumber));
				$("#organizationName").html(CommonConverter.toEmptyString(data.obj.organizationName));
				$("#createTime").html(CommonConverter.toEmptyString(data.obj.createTime));
				$("#cost").html(CommonConverter.toEmptyString(data.obj.cost));
			}
		});
		var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
		function closeWin(){
			 parent.layer.close(index);
		};
		//封装函数  实现点击事件的数据传输
		function passOrCancle(n,id){
			var remark=$("#remark").val();
			var status=n;//n=1未通过n=-1为不通过
			var param={"status":n,"id":id,"remark":remark};
			var c=JSON.stringify(param);
			//console.log(c)
			//发送ajax请求 
			$.ajax({
				type:"post",
				url:"${ctx}/tradeList/checkUpdate",
				data:c,
				contentType:"application/json",
				success:function(data){
					//console.log(data)
					progressClose();
					if(data.success){
						layer.alert('审核完成！',{skin:'layui-layer-lan',title: ['系统提示', 'background-color:#00B2EE; color:#fff;'],closeBtn: 0}, function(index){
							closeWin();
							layer.close(index);
						});
					}else{
						layer.alert("审核失败！");
					};
				},
				error:function(msg){
					progressClose();
					layer.alert("请检查您的网络连接，然后重试！");
				}
			}); 
		};
		//点击通过
		$("#affirm").click(function(){
			var id=$("#orderId").html();
			passOrCancle(1,id);
		});
		//点击不通过
		$("#cancel").click(function(){
			var id=$("#orderId").html();
			passOrCancle(-1,id);
		});
	});
</script>
</head>
<body>
	<table class="rechargeContent"> 
		<div id="orderId" style="display:none;">${id}</div>
		<tr><td>支付单号：</td><td class="toLeft" id="payOrderNumber"></td></tr>
		<tr><td>采购商：</td><td class="toLeft" id="organizationName"></td></tr>
		<tr><td>申请日期：</td><td class="toLeft" id="createTime"></td></tr>
		<tr><td>提现金额：</td><td class="toLeft" id="cost"></td></tr>
		<tr><td>备注：</td><td><textarea id="remark"  style="border:1px solid #95B8E7;font-size:12px;"></textarea></td></tr>
	</table>
		<button class="pass" id="affirm" style="line-height:30px;">通过</button>
		<button class="backOne" id="cancel">不通过</button>
	 <script type="text/javascript" src="${ctx}/jslib/layer/layer.js" charset="utf-8"></script>
</body>
</html>